﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Common;
using System.Data;

namespace LG.DB
{
    /// <summary>
    /// 事务中命令信息
    /// </summary>
    public class TransInfo
    {
        private string _text;
        private CommandType _type = CommandType.Text;
        private List<DbParameter> _params=new List<DbParameter> ();
        private int _affectRows = 0;

        /// <summary>
        /// sql语句或存储过程
        /// </summary>
        public string Text
        {
            get { return _text; }
            set { _text = value; }
        }

        /// <summary>
        /// 命令的类型
        /// </summary>
        public CommandType Type
        {
            get { return _type; }
            set { _type = value; }
        }

        /// <summary>
        /// 命令参数
        /// </summary>
        public List<DbParameter> Params
        {
            get { return _params; }
            set { _params = value; }
        }

        /// <summary>
        /// 命令执行影响的行数
        /// </summary>
        public int AffectRows
        {
            get { return _affectRows; }
            set { _affectRows = value; }
        }

        public TransInfo()
            : this(string.Empty)
        { }

        public TransInfo(string text)
            : this(text, CommandType.Text)
        { }

        public TransInfo(string text, CommandType type)
        {
            _text = text;
            _type = type;
        }
    }
}
